﻿// <copyright file="iisEndpoint.cs" company="SharpSTS">
// Copyright (c) 2007, 2008 All Right Reserved, http://sharpsts.com/
//
// This source is subject to the Microsoft Permissive License.
// Please see the License.txt file for more information.
// All other rights reserved.
//
// THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY 
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//
// </copyright>
// <author>Barry Dorrans</author>
// <email>barryd@idunno.org</email>
// <date>2008-06-14</date>
// <summary>Represents the an IISEndpoint configuration element.</summary>

namespace SharpSTS.Configuration
{
    using System.Configuration;
    
    /// <summary>
    /// Represents the type and service file name for the STS endpoints.
    /// </summary>
    /// <remarks>
    /// This is used when the endpoints are hosted within IIS.
    /// </remarks>
    /// <example>
    /// &lt;add name="SharpSTS.UserNameAuthSTS" serviceFileName="username.svc" /&gt;
    /// </example>
    public sealed class IISEndpoint : ConfigurationElement
    {
        /// <summary>
        /// The name configuration element attribute name.
        /// </summary>
        private const string NameAttribute = "name";

        /// <summary>
        /// The service file name attribute name.
        /// </summary>
        private const string ServiceFileNameAttribute = "serviceFileName";

        /// <summary>
        /// Gets or sets the name of the IIS Endpoint.
        /// </summary>
        /// <value>The name of the IIS Endpoint.</value>
        [ConfigurationProperty(NameAttribute, IsKey = true, IsRequired = true)]
        public string Name
        {
            get
            {
                return ((string)(base[NameAttribute]));
            }

            set
            {
                base[NameAttribute] = value;
            }
        }

        /// <summary>
        /// Gets or sets the service file name for the IIS endpoint.
        /// </summary>
        /// <value>The value of the service file name for the IIS endpoint.</value>
        [ConfigurationProperty(ServiceFileNameAttribute, IsKey = false, IsRequired = true)]
        public string ServiceFileName
        {
            get
            {
                return ((string)(base[ServiceFileNameAttribute]));
            }

            set
            {
                base[ServiceFileNameAttribute] = value;
            }
        }
    }
}
